@extends('layouts.main')

@section('title', '编辑零售合同数据(指标)')

@section('content')
<h3>@yield('title')</h3>
<div class="btn-group" role="group">
  	<a href="{{ action('BusinessData\RetailContractIndicatorController@index') }}" class="btn btn-primary">返回列表</a>
</div>

<form class="form-horizontal" method="post" action="{{ action('BusinessData\RetailContractIndicatorController@update', $model) }}">
    @csrf
    @method('PUT')

    <div class="form-group">
		<label for="year" class="col-sm-2 control-label">年度</label>
		<div class="col-sm-2">
			<input class="form-control" id="year" name="year" placeholder="请输入年份" value="{{ old('year', $model->year) }}">
			@if($errors->first('year'))
			<p class="help-block error">{{ $errors->first('year') }}</p>
			@endif
		</div>
    </div>

	<div class="form-group">
		<label for="payer_code" class="col-sm-2 control-label">客户代码</label>
		<div class="col-sm-3">
			<input class="form-control" id="payer_code" name="payer_code" placeholder="请输入客户代码" value="{{ old('payer_code', $model->payer_code) }}">
			@if($errors->first('payer_code'))
			<p class="help-block error">{{ $errors->first('payer_code') }}</p>
			@endif
		</div>
    </div>

    <div class="form-group">
		<label for="category_contract_id" class="col-sm-2 control-label">合同大类</label>
		<div class="col-sm-2">
			<select class="form-control" id="category_contract_id" name="category_contract_id">
				@foreach($category_contracts as $category_contract)
				<option value="{{ $category_contract->id }}" @if(old('category_contract_id', $model->category_contract_id) == $category_contract->id) selected @endif>{{ $category_contract->name }}</option>
				@endforeach
			</select>
			@if($errors->first('category_contract_id'))
			<p class="help-block error">{{ $errors->first('category_contract_id') }}</p>
			@endif
		</div>
    </div>

	<div class="form-group">
		<label for="amount" class="col-sm-2 control-label">指标金额</label>
		<div class="col-sm-3">
			<input class="form-control" id="amount" name="amount" placeholder="请输入指标金额" value="{{ old('amount', $model->amount) }}">
			@if($errors->first('amount'))
			<p class="help-block error">{{ $errors->first('amount') }}</p>
			@endif
		</div>
    </div>

    <div class="form-group">
		<div class="col-sm-offset-2 col-sm-10">
			<button type="submit" class="btn btn-primary">提交</button>
		</div>
    </div>
</form>

@endsection